<!--
  文件描述：条件组件
  nodeType： 0发起人 、1中间节点人 、2条件 、3具体条件
-->
<template>
  <div class="branch-wrap">
    <div class="branch-wrap-box">

      <div class="branch-box">
        <div class="branch-box-add-button" @click="disabled ? null : add()">{{ disabled ? '条件' : '添加条件' }}</div>
        <conditonItemCol
            v-for="(item, index) in processData.conditionNodes || []"
            :key="index"
            :processData="item"
            :disabled="disabled"
            :frist="index === 0"
            :last="index === (processData.conditionNodes || []).length - 1"
        />
      </div>
      <!--  按钮以及线  -->
      <add-node-btn :process-data="processData" :disabled="disabled"/>
    </div>
  </div>
</template>
<script setup name="conditionPage">
import { inject } from 'vue'
import addNodeBtn from '@/view/workflow/config/components/comp/add-node-btn.vue'
import conditonItemCol from '@/view/workflow/config/components/comp/condition-item-col.vue'
const props = defineProps({
  processData: {
    type: Object,
    default: {}
  },
  disabled: {
    type: Boolean,
    default: false
  }
})

const addData = inject('addData')
const add = () => {
  console.log(111)
  addData?.({
    type: '3', // 添加具体条件
    nodeId: props.processData.nodeId
  })
}

</script>
<style scoped lang="less">
@import '@/view/workflow/config/components/index.less';
</style>